<template>
  <el-dialog
  title="计算步长"
  :visible.sync="dialogVisible"
  width="30%"
  :before-close="handleClose">
  <div>
    <div style="">
        <div>
            <div style="margin:5px 10px 3px 10px">接收频率</div>
            <el-input size="mini" style="width:180px;margin-left:10px" v-model="frequency"></el-input>GHz
        </div>
        <div>
            <div style="margin:5px 10px 3px 10px">天线口径</div>
            <el-input size="mini" style="width:180px;margin-left:10px" v-model="antennaAperture"></el-input>米
        </div>
        <button type="button" class="enter-button" style="margin:5px 5px 5px 10px;width:70px" @click="confirm">确认</button>
    </div>
</div>
</el-dialog>
</template>
<script>
import { calStep} from '../../../api/tansfer';
export default {
  data() {
    return {
      dialogVisible: false,
      frequency:null,
      antennaAperture:null,
      step:null,
    };
  },
  mounted() {
  },
  methods: {
    handleClose(){
        this.dialogVisible = false;
    },
    confirm(){
        if(this.frequency == null || this.antennaAperture == null){
            this.$message.error("请输入参数！")
            return;
        }
        const param = {
            frequency: this.frequency,
            antennaAperture: this.antennaAperture,
            manualStepSize: 0,
        }
        calStep(param).then((res) => {
            this.step = res.data.data.manualStepSize
            this.$emit("getStep",this.step)
            this.dialogVisible = false;
        }).catch(() => {
            this.$message({
                type: 'error',
                message: '计算失败'
            });
        });
    },
  },
};
</script>

<style lang="less" scoped>

</style>
